<template>
    <div class="xuqiu">
        <div class="title">
            <span>專題報道</span>
            <a href="#/news" class="more">更多</a>
        </div>
        <div class="main">
            <div class="main-top"  @click="go(list[0])">
                <img :src="list[0]?newsImg+list[0].image:''" alt="">
                <div class="tips">
                    {{list[0]?list[0].subject:''}}
                </div>
            </div>
                <div class="main-item" v-for="item in list"  @click="go(item)">
                    <span class="item-title">{{item.subject}}</span>
                    <span>{{item.content}}</span>
                </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "index-xuqiu",
        data() {
            return {
                list:[]
            }
        },
        mounted() {
            this.getTop10News()
        },
        methods:{
          go(item) {
            window.location.href="#/pageDetail/"+item.id
          },
            getTop10News() {
                this.$http.post(this.API.get_top10_news).then((res) => {
                    let $this = this;
                if(res.status ===200 && res.data.length>0){
                    this.list = res.data;
                }
            })
            },
        }
    }
</script>

<style scoped lang="less">
    .xuqiu{
        width: 100%;
        .title{
            height: 40px;
            background-color: #f4f4f4;
            font-size: 20px;
            color: #000000;
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            padding: 0 12px;
            font-weight: bold;
            .more{
                font-size: 16px;
                color: #7d3e03;
                cursor: pointer;
            }
        }
        .main{
            background-color: #f9f9f9;
            width: 100%;
            height: 360px;
            overflow: hidden;
            border-right: 1px solid #e6e6e6;
            border-left: 1px solid #e6e6e6;
            border-bottom: 1px solid #e6e6e6;
            box-sizing: border-box;
            padding: 12px;
           .main-top{
               box-sizing: border-box;
               width: 100%;
               height: 150px;
               position: relative;
               margin-bottom: 20px;
               cursor: pointer;
               img{
                   width: 100%;
                   height: 100%;
               }
               .tips{
                   width: 100%;
                   height: 30px;
                   line-height: 30px;
                   text-align: center;
                   overflow: hidden;
                   text-overflow: ellipsis;
                   white-space: nowrap;
                   position: absolute;
                   bottom: 0;
                   left: 0;
                   color: #ffffff;
                   background-color: rgba(0,0,0,.5);
               }
           }
            .main-news{
                width: 100%;
            }
            .main-item{
                box-sizing: border-box;
                padding:10px;
                background-color: #ffffff;
                width: 100%;
                font-size: 12px;
                color: gray;
                display: flex;
                flex-direction: column;
                align-items: center;
                cursor: pointer;
                border-bottom: 1px dashed #e6e6e6;
                span{
                    width: 100%;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }
                .item-title{
                    color:  #7d3e03;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }
            }
        }
    }

</style>